<template>
  <div class="box" v-html="allcontent"></div>
</template>
  <script>
import axios from "axios";
export default {
  name: "header",
  props: {
    id: {
      type: Number,
      default: function () {
        return -1;
      },
    },
  },
  data() {
    return {
      allcontent: "",
    };
  },
  mounted() {
    this.getContetn();
  },
  methods: {
    getContetn() {
      let data = {
        id: this.id,
        pageNum: 1,
        pageSize: 10,
      };
      axios.post(`/textcontent/search`, data).then((res) => {
        console.log("获取", res);
        let { code, message, result } = res;
        if (code == "ok") {
          this.allcontent = result.data[0].content;
        } else {
        }
      });
    },
  },
};
</script>

  <style scoped>
.box {
  padding: 60px;
  margin: 0 auto;
  width: 1920px;
  /* height: 1966px; */
  /* 其他样式设置，比如背景尺寸、重复等 */
  background-size: cover; /* 让背景图片覆盖整个元素 */
  background-position: center; /* 背景图片居中显示 */
  background-color: #fff;
  text-align: center;
}
</style>